package com.zhiyou.brank.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.zhiyou.brank.service.FlyDutyService;
import com.zhiyou.utils.JsonResult;

@RestController
@RequestMapping("duty/")
public class FlyDutyController {
@Autowired
FlyDutyService flyDutyService;
	@GetMapping("selectDutyOne/{week_id}/{class_id}")
	public JsonResult selectDutyOne(@PathVariable("week_id")Integer week_id,@PathVariable("class_id")Integer class_id,HttpServletResponse req,HttpServletRequest rep){		
		return new JsonResult(flyDutyService.selectDutyOne(week_id, class_id),"查询成功");	
	}
	@GetMapping("selectDutyTwo/{week_id}/{class_id}")
	public JsonResult selectDutyTwo(@PathVariable("week_id")Integer week_id,@PathVariable("class_id")Integer class_id,HttpServletResponse req,HttpServletRequest rep){		
		return new JsonResult(flyDutyService.selectDutyTwo(week_id, class_id),"查询成功");	
	}
	/**
	 * 添加值班模块信息
	 * @param teacher_id
	 * @param teacher_class_id
	 * @param student_id
	 * @param week
	 * @param class_id
	 * @param week_id
	 * @param duty_id
	 * @param req
	 * @param rep
	 */
	@PostMapping("addDuty")
	public void addDuty(Integer teacher_id,Integer teacher_class_id,			
			Integer student_id,String week,Integer class_id,
			Integer week_id,HttpServletResponse req,HttpServletRequest rep){		
		flyDutyService.addDuty(teacher_id, teacher_class_id, student_id, week, class_id, week_id);	
	}
	/**
	 * 修改值日模块信息
	 * @param teacher_id
	 * @param teacher_class_id
	 * @param student_id
	 * @param week
	 * @param class_id
	 * @param week_id
	 */
	@PostMapping("updateDuty")
	public void updateDuty(Integer teacher_id,Integer teacher_class_id,			
			Integer student_id,String week,Integer class_id,
			Integer week_id,Integer duty_id,HttpServletResponse req,HttpServletRequest rep) {
		flyDutyService.updateDuty(teacher_id, teacher_class_id, student_id, week, class_id, week_id, duty_id);
	}
	/**
	 * 根据id删除
	 * @param duty_id
	 * @param req
	 * @param rep
	 */
	@PostMapping("deleteDuty")
	public void deleteDuty(Integer duty_id,HttpServletResponse req,HttpServletRequest rep) {
		flyDutyService.deleteDuty(duty_id);
	}
	
}

